package cn.shyouchi.wuguanjia.android.ui.attendance;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import java.util.List;

/**
 * Created by Eenie on 2016/12/14 at 15:15
 * Email: 472279981@qq.com
 * Des:
 */

public class AttendanceEntity {


    /**
     * resultCode : 0
     * resultMessage : [{"day":"2016-12-15","service":{"id":119,"servicesname":"常日班","starttime":"09:00:00","endtime":"17:00:00","time":8},"checkin":{"type":1,"address":"我的位置","time":"11:58","attendance":"迟到"},"signback":{"type":1,"address":"我的位置","time":"11:58","attendance":"迟到"}}]
     */

    private int resultCode;
    private List<ResultMessageBean> resultMessage;

    public int getResultCode() {
        return resultCode;
    }

    public void setResultCode(int resultCode) {
        this.resultCode = resultCode;
    }

    public List<ResultMessageBean> getResultMessage() {
        return resultMessage;
    }

    public void setResultMessage(List<ResultMessageBean> resultMessage) {
        this.resultMessage = resultMessage;
    }

    public static class ResultMessageBean implements Parcelable {
        /**
         * day : 2016-12-15
         * service : {"id":119,"servicesname":"常日班","starttime":"09:00:00","endtime":"17:00:00","time":8}
         * checkin : {"type":1,"address":"我的位置","time":"11:58","attendance":"迟到"}
         * signback : {"type":1,"address":"我的位置","time":"11:58","attendance":"迟到"}
         */

        private String day;
        private ServiceBean service;
        private CheckinBean checkin;
        private SignbackBean signback;

        public String getDay() {
            return day;
        }

        public void setDay(String day) {
            this.day = day;
        }

        public ServiceBean getService() {
            return service;
        }

        public void setService(ServiceBean service) {
            this.service = service;
        }

        public CheckinBean getCheckin() {
            return checkin;
        }

        public void setCheckin(CheckinBean checkin) {
            this.checkin = checkin;
        }

        public SignbackBean getSignback() {
            return signback;
        }

        public void setSignback(SignbackBean signback) {
            this.signback = signback;
        }

        public static class ServiceBean implements Parcelable {
            /**
             * id : 119
             * servicesname : 常日班
             * starttime : 09:00:00
             * endtime : 17:00:00
             * time : 8
             */

            private int id;
            private String servicesname;
            private String starttime;
            private String endtime;
            private int time;

            public int getId() {
                return id;
            }

            public void setId(int id) {
                this.id = id;
            }

            public String getServicesname() {
                return servicesname;
            }

            public void setServicesname(String servicesname) {
                this.servicesname = servicesname;
            }

            public String getStarttime() {
                return starttime;
            }

            public void setStarttime(String starttime) {
                this.starttime = starttime;
            }

            public String getEndtime() {
                return endtime;
            }

            public void setEndtime(String endtime) {
                this.endtime = endtime;
            }

            public int getTime() {
                return time;
            }

            public void setTime(int time) {
                this.time = time;
            }

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeInt(this.id);
                dest.writeString(this.servicesname);
                dest.writeString(this.starttime);
                dest.writeString(this.endtime);
                dest.writeInt(this.time);
            }

            public ServiceBean() {
            }

            protected ServiceBean(Parcel in) {
                this.id = in.readInt();
                this.servicesname = in.readString();
                this.starttime = in.readString();
                this.endtime = in.readString();
                this.time = in.readInt();
            }

            public static final Creator<ServiceBean> CREATOR = new Creator<ServiceBean>() {
                @Override
                public ServiceBean createFromParcel(Parcel source) {
                    return new ServiceBean(source);
                }

                @Override
                public ServiceBean[] newArray(int size) {
                    return new ServiceBean[size];
                }
            };
        }

        public static class CheckinBean implements Parcelable {
            /**
             * type : 1
             * address : 我的位置
             * time : 11:58
             * attendance : 迟到
             */

            private int type;
            private String address;
            private String time;
            private String attendance;

            public boolean hasSignIn() {
                return !TextUtils.isEmpty(time);
            }

            public int getType() {
                return type;
            }

            public void setType(int type) {
                this.type = type;
            }

            public String getAddress() {
                return address;
            }

            public void setAddress(String address) {
                this.address = address;
            }

            public String getTime() {
                return time;
            }

            public void setTime(String time) {
                this.time = time;
            }

            public String getAttendance() {
                return attendance;
            }

            public void setAttendance(String attendance) {
                this.attendance = attendance;
            }

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeInt(this.type);
                dest.writeString(this.address);
                dest.writeString(this.time);
                dest.writeString(this.attendance);
            }

            public CheckinBean() {
            }

            protected CheckinBean(Parcel in) {
                this.type = in.readInt();
                this.address = in.readString();
                this.time = in.readString();
                this.attendance = in.readString();
            }

            public static final Creator<CheckinBean> CREATOR = new Creator<CheckinBean>() {
                @Override
                public CheckinBean createFromParcel(Parcel source) {
                    return new CheckinBean(source);
                }

                @Override
                public CheckinBean[] newArray(int size) {
                    return new CheckinBean[size];
                }
            };
        }

        public static class SignbackBean implements Parcelable {
            /**
             * type : 1
             * address : 我的位置
             * time : 11:58
             * attendance : 迟到
             */

            private int type;
            private String address;
            private String time;
            private String attendance;

            public boolean hasSignOut() {
                return !TextUtils.isEmpty(time);
            }

            public int getType() {
                return type;
            }

            public void setType(int type) {
                this.type = type;
            }

            public String getAddress() {
                return address;
            }

            public void setAddress(String address) {
                this.address = address;
            }

            public String getTime() {
                return time;
            }

            public void setTime(String time) {
                this.time = time;
            }

            public String getAttendance() {
                return attendance;
            }

            public void setAttendance(String attendance) {
                this.attendance = attendance;
            }

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeInt(this.type);
                dest.writeString(this.address);
                dest.writeString(this.time);
                dest.writeString(this.attendance);
            }

            public SignbackBean() {
            }

            protected SignbackBean(Parcel in) {
                this.type = in.readInt();
                this.address = in.readString();
                this.time = in.readString();
                this.attendance = in.readString();
            }

            public static final Creator<SignbackBean> CREATOR = new Creator<SignbackBean>() {
                @Override
                public SignbackBean createFromParcel(Parcel source) {
                    return new SignbackBean(source);
                }

                @Override
                public SignbackBean[] newArray(int size) {
                    return new SignbackBean[size];
                }
            };
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.day);
            dest.writeParcelable(this.service, flags);
            dest.writeParcelable(this.checkin, flags);
            dest.writeParcelable(this.signback, flags);
        }

        public ResultMessageBean() {
        }

        protected ResultMessageBean(Parcel in) {
            this.day = in.readString();
            this.service = in.readParcelable(ServiceBean.class.getClassLoader());
            this.checkin = in.readParcelable(CheckinBean.class.getClassLoader());
            this.signback = in.readParcelable(SignbackBean.class.getClassLoader());
        }

        public static final Parcelable.Creator<ResultMessageBean> CREATOR = new Parcelable.Creator<ResultMessageBean>() {
            @Override
            public ResultMessageBean createFromParcel(Parcel source) {
                return new ResultMessageBean(source);
            }

            @Override
            public ResultMessageBean[] newArray(int size) {
                return new ResultMessageBean[size];
            }
        };
    }
}
